﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="DailyMoonwf.aspx.cs" Inherits="Catering.Catering_Page.richang.DailyMoonwf" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <link href="../../Style/center.css" rel="stylesheet" type="text/css" />
    <link href="../../Style/sysData.css" rel="stylesheet" type="text/css" />
    <script src="../../Scripts/jquery-1.4.1.js" type="text/javascript"></script>
    <script language="javascript" type="text/javascript" src="../../Scripts/My97DatePicker/WdatePicker.js"></script>
    <script type="text/javascript">
        var _rbmvalue = "是";
        var _isCommunicate = "否";
        $(document).ready(function () {
            
            $("#DishDate").focus(function () { WdatePicker({ dateFmt: 'yyyy-MM-dd' }) });
            $("#CheckDate").focus(function () { WdatePicker({ dateFmt: 'yyyy-MM-dd' }) });

            $("#ddl_moon").change(function () {
                Get($(this).val());
            }); 

            $("input[name='rbisCommunicate']").change(function () {
                _isCommunicate = $(this).val();
            });
            $("input[name='rbm']").change(function () {
                var _thisval = $(this).val();
                _rbmvalue = _thisval;
                rbm_change();
            });
            //rbm_change();
            //Get(0);
            $("#rbmF").attr("checked", "checked");
            $('input').attr("disabled", "disabled");
            $("input[name='rbm']").removeAttr("disabled");
        });


        function rbm_change() {
            if (_rbmvalue == "是") {
                $("#ddl_moon").removeAttr("disabled");
                $("#btnAdd").removeAttr("disabled");
                $("#btnDel").removeAttr("disabled");
                $('input').removeAttr("disabled");

                var hdn_currentClassID = $("#hdn_currentClassID").val();

                $("#ddl_moon").empty();

                $("#ddl_moon").append($("<option value='-1'>请选择卫星平台</option>"))
                if (hdn_currentClassID != null && hdn_currentClassID != "") {
                    $.ajax({
                        url: "DailyMoonwf.aspx/GetMoonForDropDownList",
                        type: "POST",
                        data: "{  '_classid' :'" + hdn_currentClassID + "'}",
                        contentType: "application/json; charset=utf-8",
                        dataType: "json",
                        success: function (data) {
                            for (var i = 0; i < data.d.length; i++) {
                                var _itemMoon = data.d[i].split(",");
                                $("#ddl_moon").append($("<option value='" + _itemMoon[0] + "'>" + _itemMoon[1] + "</option>"));
                            }
                        }
                    });
                }
            } else if (_rbmvalue == "否") {
                $("#ddl_moon").empty();
                $('input').attr("disabled", "disabled");
                $("input[name='rbm']").removeAttr("disabled");
            }
        }

        //显示添加
        function Get(moonId) {
            var hdn_useDate = $("#hdn_useDate").val();
            var hdn_currentClassID = $("#hdn_currentClassID").val();
            var hdn_currentGroppID = $("#hdn_currentGroppID").val();

            var dailyid = hdn_useDate + "," + hdn_currentClassID + "," + hdn_currentGroppID+",";

            $.ajax({
                type: "POST",
                data: "{  'dialyid' :'" + dailyid + "','moonId':'" + moonId + "'}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                url: "DailyMoonwf.aspx/Get",
                success: function (data) {
                    if (data.d[0] != "error") {
                        $("#WoJu").val(data.d[0]);
                        $("#CanJu").val(data.d[1]);
                        $("#Rice").val(data.d[2]);
                        $("#Surfice").val(data.d[3]);
                        $("#Oil").val(data.d[4]);
                        $("#DishDate").val(data.d[5]);
                        $("#CheckDate").val(data.d[6]);
                        $("#Area").val(data.d[7]);
                        $("#Oilstove").val(data.d[8]);
                        $("#SmokeMachineWash").val(data.d[9]);
                        $("#FireExtinguisher").val(data.d[10]);
                        $("#FireBlanket").val(data.d[11]);
                        $("#HighRiskEqui").val(data.d[12]);
                        $("#hdn_id").val(data.d[16]);
                        $("#inWorkNum").val(data.d[14]);
                        $("#unWorkNum").val(data.d[15]);
                        if (data.d[17] == "true") {
                            $("#IsCommunicateT").attr("checked", "checked");
                        } else {
                            $("#IsCommunicateF").attr("checked", "checked");
                        }
                        if (data.d[18] == null || data.d[18] == "") {
                            $("#EquiOperationT").attr("checked", "checked");
                        } else {
                            $("#EquiOperationF").attr("checked", "checked");
                            $("#EquiOperation").val(data.d[18]);
                        }
                        $("#BedsNum").val(data.d[19]);
                        //var IsCommunicate = _isCommunicate;

                    }
                }
            });
            
        }

        //显示修改
        function Edit(cid) {

        }

        //添加数据
        function btn_Add() {
            if (_rbmvalue == "是") {
                var WoJu = $("#WoJu").val();
                var CanJu = $("#CanJu").val();
                var Rice = $("#Rice").val();
                var Surfice = $("#Surfice").val();
                var Oil = $("#Oil").val();
                var DishDate = $("#DishDate").val();
                var CheckDate = $("#CheckDate").val();
                var IsCommunicate = _isCommunicate;
                var Area = $("#Area").val();
                var Oilstove = $("#Oilstove").val();
                var SmokeMachineWash = $("#SmokeMachineWash").val();
                var FireExtinguisher = $("#FireExtinguisher").val();
                var FireBlanket = $("#FireBlanket").val();
                var HighRiskEqui = $("#HighRiskEqui").val();
                var inWorkNum = $("#inWorkNum").val();
                var unWorkNum = $("#unWorkNum").val();
                var bedsnum = $("#BedsNum").val();
                var EquiOperation = $("#EquiOperation").val();
                var ddl_moon = $("#ddl_moon").val();
                if (ddl_moon == "-1") {
                    alert("请选择卫星平台！");
                    return;
                }
                var hdn_useDate = $("#hdn_useDate").val();
                var hdn_currentClassID = $("#hdn_currentClassID").val();
                var hdn_currentGroppID = $("#hdn_currentGroppID").val();
                var hdn_id = $("#hdn_id").val();

                var dailyid = hdn_useDate + "," + hdn_currentClassID + "," + hdn_currentGroppID + ",";

                $.ajax({
                    type: "Post",
                    url: "DailyMoonwf.aspx/Add",
                    data: "{  '_WoJu' :'" + WoJu + "',  '_CanJu' :'" + CanJu + "' ,  '_Rice' :'" + Rice + "',  '_Surfice' :'" + Surfice + "' ,  '_Oil' :'" + Oil + "' ,  '_DishDate' :'" + DishDate + "' ,  '_CheckDate' : '" + CheckDate + "',  '_IsCommunicate' : '" + IsCommunicate + "',  '_Area' :'" + Area + "',  '_Oilstove' :'" + Oilstove + "' ,  '_SmokeMachineWash' : '" + SmokeMachineWash + "',  '_FireExtinguisher' :'" + FireExtinguisher + "',  '_FireBlanket' :'" + FireBlanket + "',  '_HighRiskEqui' :'" + HighRiskEqui + "','inWorkNum':'" + inWorkNum + "','unWorkNum':'" + unWorkNum + "','dailyid':'" + dailyid + "','_id':'" + hdn_id + "','EquiOperation':'" + EquiOperation + "','ddl_moon':'" + ddl_moon + "','bedsnum':'" + bedsnum + "'}",
                    contentType: "application/json; charset=utf-8",
                    dataType: "json",
                    success: function (data) {
                        if (data.d == "ok") {
                            alert("保存成功！");
                            //window.location.href = 'DailyMoonwf.aspx';
                        }
                    }
                });
            }
            else if (_rbmvalue == "否") {

            }
        }

        //修改数据
        function btn_Edit() {

        }

        function btn_Del()
        {
            var hdn_id = $("#hdn_id").val();
            $.ajax({
                type: "Post",
                url: "DailyMoonwf.aspx/Del",
                data: "{  '_id' :'" + hdn_id + "'}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (data) {
                    if (data.d == "ok") {
                        window.location.href = 'DailyMoonwf.aspx';
                    }
                }
            });
        }
    </script>
    <style type="text/css">
        .auto-style1 {
            height: 31px;
        }
    </style>
</head>
<body style="background-color: #E5F1FD">
    <input type="hidden" id="hdn_id"/>
    <form id="form1" runat="server">
        <%
            string useDate = null;
            string currentClassID = null;
            string currentGroppID = null;
            if (Session["useDate"] != null)
                useDate = Session["useDate"].ToString();
            if (Session["ClassID"] != null)
                currentClassID = Session["ClassID"].ToString();
            if (Session["GroppID"] != null)
                currentGroppID = Session["GroppID"].ToString();
        %>
        <input type="hidden" id="hdn_useDate" value='<%=useDate%>' />
        <input type="hidden" id="hdn_currentClassID" value='<%=currentClassID%>' />
        <input type="hidden" id="hdn_currentGroppID" value='<%=currentGroppID%>' />
        
        <table height="500">
            <tr>
                <td colspan="2" align="right">
                    <input type="button" id="btnAdd" onclick="btn_Add()" class="input_btn_a" value="保存" />
                </td>
            </tr>
            <tr>
                <td colspan="2">卫星平台汇报：
                    <input type="radio" id="rbmT" name="rbm" value="是" />是
	                <input type="radio" id="rbmF" name="rbm" value="否" />否
	                <select id="ddl_moon">
                    </select>
                </td>
            </tr>
            <tr>
                <td align="left" class="auto-style1">在岗人数：<input id="inWorkNum" type="text" size="9" />
                </td>
                <td align="left" class="auto-style1">倒班人数：<input id="unWorkNum" type="text" size="9" />
                </td>
            </tr>
            <%--<tr>
                <td align="right" colspan="2">
                    <table>
                        <tr>
                            <td style="display:none;">
                                <input type="button" id="btnDel" onclick="btn_Del()" class="input_btn_a" value="删除" />
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>--%>
            <tr>
                <td align="left">床位数量：<input id="BedsNum" type="text" size="9" />
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <table width="100%" style="height:100%" id="table_wzcb">
                        <tr>
                            <td colspan="4"><font style="color: red;">（*）</font>1.物资储备</td>
                        </tr>
                        <tr>
                            <td align="right">卧具（套）：</td>
                            <td>
                                <input id="WoJu" type="text" size="9" /></td>
                            <td align="center">餐具（套）：</td>
                            <td>
                                <input id="CanJu" type="text" size="9" /></td>
                        </tr>
                        <tr>
                            <td align="right">米（袋）：</td>
                            <td>
                                <input id="Rice" type="text" size="9" /></td>
                            <td align="center">面（袋）：</td>
                            <td>
                                <input id="Surfice" type="text" size="9" /></td>
                        </tr>
                        <tr>
                            <td align="right">油（桶）：</td>
                            <td>
                                <input id="Oil" type="text" size="9" /></td>
                            <td>&nbsp;</td>
                            <td>&nbsp;</td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <table width="100%" id="table_rcjk">
                        <tr>
                            <td colspan="4"><font style="color: red;">（*）</font>2.日常监控</td>
                        </tr>
                        <tr>
                            <td align="right">上菜日期：</td>
                            <td>
                                <input id="DishDate" type="text" size="9" /></td>
                            <td align="right">安全员巡检日期：</td>
                            <td>
                                <input id="CheckDate" type="text" size="9" /></td>
                        </tr>
                        <tr>
                            <td align="right">是否沟通：</td>
                            <td colspan="3">
                                <input type="radio" name="rbisCommunicate" id="IsCommunicateT" value="是" />是
		                            <input type="radio" name="rbisCommunicate" id="IsCommunicateF" value="否" />否
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <table width="100%" id="table_cfzt">
                        <tr>
                            <td colspan="4"><font style="color: red;">（*）</font>3.厨房状态：</td>
                        </tr>
                        <tr>
                            <td align="right">面积（m²）：</td>
                            <td>
                                <input id="Area" type="text" size="9" /></td>
                            <td align="right">气/油灶：</td>
                            <td>
                                <input id="Oilstove" type="text" size="9" /></td>
                        </tr>
                        <tr>
                            <td align="right">烟机清洗：</td>
                            <td>
                                <input id="SmokeMachineWash" type="text" size="9" /></td>
                            <td align="right">灭火器：</td>
                            <td>
                                <input id="FireExtinguisher" type="text" size="9" /></td>
                        </tr>
                        <tr>
                            <td align="right">
                                <p>灭火毯：</p>
                            </td>
                            <td>
                                <input id="FireBlanket" type="text" size="9" /></td>
                            <td align="right">高危设备：</td>
                            <td>
                                <input id="HighRiskEqui" type="text" size="9" /></td>
                        </tr>
                        <tr>
                            <td align="right">设备运转： </td>
                            <td colspan="3">
                                <input type="radio" id="EquiOperationT" name="EquiOperation" value="radiobutton" />正常
		                            <input type="radio" id="EquiOperationF" name="EquiOperation" value="radiobutton" />异常
                            </td>
                        </tr>
                        <tr>
                            <td align="right"></td>
                            <td colspan="3">
                                <input id="EquiOperation" style="width: 100%" type="text" />
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
    </form>
</body>
</html>
